<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="824.42">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001ae7}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ad1818}
span.s1 {color: #000000}
span.s2 {text-decoration: underline}
span.s3 {color: #0015b9}
span.s4 {color: #606060}
span.s5 {color: #2c7011}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><b>PV_Freeze<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>freeze FFT frames</b></p>
<p class="p2"><br></p>
<p class="p3"><b>PV_Freeze(buffer, freeze)</b></p>
<p class="p2"><br></p>
<p class="p3">Freezes magnitudes at current levels when freeze &gt; 0, and advances phase according to difference between frames to try and maintain currect spectral quality.</p>
<p class="p2"><br></p>
<p class="p3"><b>buffer</b> - fft buffer.</p>
<p class="p3"><b>freeze</b> - if freeze &gt; 0 then magnitudes are frozen at current levels.</p>
<p class="p2"><br></p>
<p class="p4"><span class="s1">See also <a href="FFT Overview.html"><span class="s2">FFT Overview</span></a>.</span></p>
<p class="p2"><br></p>
<p class="p5">s.boot;</p>
<p class="p5">(</p>
<p class="p5">b = <span class="s3">Buffer</span>.alloc(s,1024);</p>
<p class="p6"><span class="s1">c = </span><span class="s3">Buffer</span><span class="s1">.read(s,</span>"sounds/a11wlk01.wav"<span class="s1">);</span></p>
<p class="p5">)</p>
<p class="p7"><br></p>
<p class="p8">// compare PV_Freeze with PV_MagFreeze</p>
<p class="p5">(</p>
<p class="p5"><span class="s3">SynthDef</span>(<span class="s4">"help-freeze"</span>, { <span class="s3">arg</span> out=0, bufnum=0;</p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s3">var</span> in, chain;</p>
<p class="p5"><span class="Apple-tab-span">	</span>in = <span class="s3">SinOsc</span>.ar(<span class="s3">LFNoise1</span>.kr(5.2,250,400));</p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s3">FFT</span>(bufnum, in);</p>
<p class="p8"><span class="s1"><span class="Apple-tab-span">	</span></span>// uncomment the line below to compare while ...</p>
<p class="p8"><span class="s1"><span class="Apple-tab-span">	</span></span>//chain = PV_MagFreeze(chain, SinOsc.kr(0.2) );<span class="Apple-converted-space"> </span></p>
<p class="p8"><span class="s1"><span class="Apple-tab-span">	</span></span>// commenting the line below<span class="Apple-converted-space"> </span></p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s3">PV_Freeze</span>(chain, <span class="s3">SinOsc</span>.kr(0.2) );<span class="Apple-converted-space"> </span></p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s3">Out</span>.ar(out, 0.5 * <span class="s3">IFFT</span>(chain).dup);</p>
<p class="p5">}).play(s,[<span class="s5">\out</span>, 0, <span class="s5">\bufnum</span>, b.bufnum]);</p>
<p class="p7"><br></p>
<p class="p5">)</p>
<p class="p7"><br></p>
<p class="p5">(</p>
<p class="p8">//trig with MouseY</p>
<p class="p5"><span class="s3">SynthDef</span>(<span class="s4">"help-magFreeze2"</span>, { <span class="s3">arg</span> out=0, bufnum=0, soundBufnum=2;</p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s3">var</span> in, chain;</p>
<p class="p5"><span class="Apple-tab-span">	</span>in = <span class="s3">PlayBuf</span>.ar(1, soundBufnum, <span class="s3">BufRateScale</span>.kr(soundBufnum), loop: 1);</p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s3">FFT</span>(bufnum, in);</p>
<p class="p8"><span class="s1"><span class="Apple-tab-span">	</span></span>// uncomment the line below to compare while ...</p>
<p class="p8">//<span class="Apple-tab-span">	</span>chain = PV_MagFreeze(chain, MouseY.kr &gt; 0.5 );<span class="Apple-converted-space"> </span></p>
<p class="p8"><span class="s1"><span class="Apple-tab-span">	</span></span>// commenting the line below<span class="Apple-converted-space"> </span></p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s3">PV_Freeze</span>(chain, <span class="s3">MouseY</span>.kr &gt; 0.5 );<span class="Apple-converted-space"> </span></p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s3">Out</span>.ar(out, 0.5 * <span class="s3">IFFT</span>(chain).dup);</p>
<p class="p5">}).play(s,[<span class="s5">\out</span>, 0, <span class="s5">\bufnum</span>, b.bufnum, <span class="s5">\soundBufnum</span>, c.bufnum]);</p>
<p class="p5">)</p>
<p class="p7"><br></p>
<p class="p5">b.free; c.free;</p>
</body>
</html>
